﻿'''
Created on 2011-5-27
@author: Administrator
'''
#coding=utf-8
import os
import shutil



def removeDir(dir):
     for root, dirs, files in os.walk(dir, True, None, False):
         if '.svn' in root:
             print("the root is: ", root)
             files = os.listdir(root)
             for f in files:
                 if (os.path.isfile(os.path.join(root,f)) == True):
                     print('the file name is:', os.path.splitext(os.path.join(root,f))[0])
                     #删除文件
                     f = os.path.join(root,f)
                     os.system('DEL /F /S /Q "%s"' % f)

                     #os.system(r'RD /S /Q "%s"' % item)
                     #os.remove(os.path.join(root,f))
             #删除主目录
             os.removedirs(root)



if __name__ == '__main__':
    dir = raw_input("root dir")
    if(dir==""):
        dir = os.path.abspath(os.path.curdir)

    removeDir(dir)